package com.lovesher.payment.common.enums;

/**
 * 支付订单结果状态枚举
 * 
 */
public enum EnumAlipayTradeStatus {

	WAIT_BUYER_PAY(0,"WAIT_BUYER_PAY", "交易创建，等待买家付款"), 
	TRADE_CLOSED(1,"TRADE_CLOSED", "未付款交易超时关闭，或支付完成后全额退款"), 
	TRADE_SUCCESS(2,"TRADE_SUCCESS", "交易支付成功"),
	TRADE_FINISHED(3,"TRADE_FINISHED","交易结束，不可退款");

	private int status;
	private String name;
	private String content;

	private EnumAlipayTradeStatus(int status,String name, String content) {
		this.status = status;
		this.content = content;
		this.name = name;
	}

	public int getValue() {
		return this.status;
	}

	public String getName(){
		return this.name;
	}
	
	public String getContent() {
		return this.content;
	}

	public static EnumAlipayTradeStatus valueOf(int status) {
		EnumAlipayTradeStatus ret = null;
		for (EnumAlipayTradeStatus stt : EnumAlipayTradeStatus.values()) {
			if (stt.getValue() == status) {
				ret = stt;
				break;
			}
		}
		return ret;
	}
	
	public static EnumAlipayTradeStatus nameOf(String name) {
		EnumAlipayTradeStatus ret = null;
		for (EnumAlipayTradeStatus stt : EnumAlipayTradeStatus.values()) {
			if (stt.getName().equals(name)) {
				ret = stt;
				break;
			}
		}
		return ret;
	}

	public static String contentOf(int status) {
		EnumAlipayTradeStatus ret = null;
		for (EnumAlipayTradeStatus stt : EnumAlipayTradeStatus.values()) {
			if (stt.getValue() == status) {
				ret = stt;
				break;
			}
		}
		return ret.getContent();
	}
}
